$(document).ready(function () {
    toastr.options = {
        "closeButton": true,
        "debug": false,
        "progressBar": true,
        "positionClass": "toast-top-right",
        "onclick": null,
        "showDuration": "400",
        "hideDuration": "1000",
        "timeOut": "7000",
        "extendedTimeOut": "1000",
        "showEasing": "swing",
        "hideEasing": "linear",
        "showMethod": "fadeIn",
        "hideMethod": "fadeOut"
    }
    let flag = true;
    $("#inlineCheckbox2").on('click', function () {
        if (flag) {
            $("input[name='inp-check-box']").prop("checked", true);
            flag = false;
        } else {
            $("input[name='inp-check-box']").prop("checked", false);
            flag = true;
        }
    });
});


function save2Storage(id){
    // TODO:可以选择商品入库
    // let selects = [];
    // let count = 0;
    // $("input[name='inp-check-box']:checked").each(function () {
    //     if ($(this).prop('checked')) {
    //         //如果当前属性为checked
    //         selects[count++] = $(this).val();
    //     }
    // });
    // console.log(selects)
    //直接全部入库
    console.log(id)
    $.post('/admin/business/storage/add/'+id,{},function (resp){
        if (resp.data){
            toastr.success(resp.message,'提示')
            setTimeout(function () {
                window.location.reload()
            },2000)
        }else{
            toastr.error(resp.message,'提示')
        }
    })
}



